﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Lexalytics4Excel.Dialogs
{
    public partial class ProjectSettings : Form
    {
        public string ProjectName = "";
        public string ProjectDesc = "";

        public ProjectSettings()
        {
            InitializeComponent();
        }

        private void ProjectSettings_Load(object sender, EventArgs e)
        {
            NameTextBox.Text = ProjectName;
            if (NameTextBox.Text.Length > 0)
                NameTextBox.Enabled = false;
            DescriptionTextBox.Text = ProjectDesc;
        }

        private void OkButton_Click(object sender, EventArgs e)
        {
            if (NameTextBox.Text.Length > 0)
            {
                ProjectName = NameTextBox.Text;
                if (DescriptionTextBox.Text.Length > 0)
                {
                    ProjectDesc = DescriptionTextBox.Text;
                    DialogResult = DialogResult.OK;
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Project description cannot be blank. Please provide a description for this project.", "Project Settings", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                }
            }
            else
            {
                MessageBox.Show("Project name cannot be blank. Please provide a name for this project.", "Project Settings", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        private void CancelButton_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.Cancel;
            this.Close();
        }
    }
}
